/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.models.entities;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "tblMessage", catalog = "cungonbaiDB", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TblMessage.findAll", query = "SELECT t FROM TblMessage t"),
    @NamedQuery(name = "TblMessage.findByMessageId", query = "SELECT t FROM TblMessage t WHERE t.messageId = :messageId"),
    @NamedQuery(name = "TblMessage.findByTimeCreate", query = "SELECT t FROM TblMessage t WHERE t.timeCreate = :timeCreate"),
    @NamedQuery(name = "TblMessage.findByMessageContent", query = "SELECT t FROM TblMessage t WHERE t.messageContent = :messageContent")})
public class TblMessage implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "messageId", nullable = false)
    private Integer messageId;
    @Column(name = "timeCreate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeCreate;
    @Size(max = 1073741823)
    @Column(name = "messageContent", length = 1073741823)
    private String messageContent;
    @JoinColumn(name = "roomUserId", referencedColumnName = "roomUserId")
    @ManyToOne
    private TblRoomUser roomUserId;

    public TblMessage() {
    }

    public TblMessage(Integer messageId) {
        this.messageId = messageId;
    }

    public Integer getMessageId() {
        return messageId;
    }

    public void setMessageId(Integer messageId) {
        this.messageId = messageId;
    }

    public Date getTimeCreate() {
        return timeCreate;
    }

    public void setTimeCreate(Date timeCreate) {
        this.timeCreate = timeCreate;
    }

    public String getMessageContent() {
        return messageContent;
    }

    public void setMessageContent(String messageContent) {
        this.messageContent = messageContent;
    }

    public TblRoomUser getRoomUserId() {
        return roomUserId;
    }

    public void setRoomUserId(TblRoomUser roomUserId) {
        this.roomUserId = roomUserId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (messageId != null ? messageId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblMessage)) {
            return false;
        }
        TblMessage other = (TblMessage) object;
        if ((this.messageId == null && other.messageId != null) || (this.messageId != null && !this.messageId.equals(other.messageId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.models.entities.TblMessage[ messageId=" + messageId + " ]";
    }
    
}
